<template>
    <div>
        <ul class="mui-table-view">
            <li class="mui-table-view-cell mui-media" v-for="item in newsInfo" :key="item.id">
                <router-link :to="'/home/newsinfo/'+item.id">
                    <img class="mui-media-object mui-pull-left" src="http://img1.imgtn.bdimg.com/it/u=3792314497,2718094270&fm=26&gp=0.jpg">
                    <div class="mui-media-body">
                        <h1>{{item.title}}</h1>
                        <p class='mui-ellipsis'>
                            <span>发表时间:{{item.add_time}}</span>
                            <span>点击次数:{{item.click}}</span>
                        </p>
                    </div>
                </router-link>
            </li>
        </ul>
    </div>
</template>

<script>
import {Toast} from "mint-ui"
export default {
    data(){
        return {
            newsInfo:[]
        }
    },
    created(){
        this.getNews()
    },
    methods:{
        getNews(){
            this.axios.get("./json/newsInfo/1.json").then(result=>{
                if(result.status==200){
                    this.newsInfo=result.data
                }
            }).catch(err=>{
                Toast("数据加载失败")
            })
        }
    }
}
</script>

<style lang="scss" scoped>
    .mui-table-view{
        h1{
            font-size: 16px;
        }
        .mui-ellipsis{
            color: #66CCFF;
            display: flex;
            justify-content: space-between;
        }
    }
</style>